package nio;

import java.nio.IntBuffer;

/**
 * @Author Klys
 * @Date 2023/5/31 16:53
 * @Description
 * @Version 1.0
 */
public class Demo01 {

    public static void main(String[] args) throws Exception {

        int[] a = new int[]{1, 2, 3, 4, 5, 6};

        //申请容量为10的int缓冲区
        IntBuffer intBuffer = IntBuffer.allocate(10);
        System.out.println(intBuffer);

        //将数组包装进buffer
        IntBuffer wrap = IntBuffer.wrap(a);
        System.out.println(wrap);

        int i = wrap.get();
        System.out.println(i);

        wrap.put(0, 10);
        System.out.println(wrap.get(0));

        int value = 1;
        if (value == 1) {
            throw new Exception();
        }


    }
}
